﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace CombinationAssistant.Models
{
    public class SixCodeModel
    {
        private int minSum = 64;
        private int maxSum = 64 + 58;
        public int Id { get; set; }
        public int RedOne { get; set; }
        public int RedTwo { get; set; }
        public int RedThree { get; set; }
        public int RedFour { get; set; }
        public int RedFive { get; set; }
        public int RedSix { get; set; }
        public int Blue { get; set; }

        public string OneToString
        {
            get
            {
                return this.RedOne.ToString("00");
            }
        }

        public string TwoToString
        {
            get
            {
                return this.RedTwo.ToString("00");
            }
        }

        public string ThreeToString
        {
            get
            {
                return this.RedThree.ToString("00");
            }
        }

        public string FourToString
        {
            get
            {
                return this.RedFour.ToString("00");
            }
        }

        public string FiveToString
        {
            get
            {
                return this.RedFive.ToString("00");
            }
        }

        public string SixToString
        {
            get
            {
                return this.RedSix.ToString("00");
            }
        }

        public string BlueToString
        {
            get
            {
                return this.Blue.ToString("00");
            }
        }


        public override string ToString()
        {
            return string.Concat(
                            this.RedOne.ToString("00"), ","
                            , this.RedTwo.ToString("00"), ","
                            , this.RedThree.ToString("00"), ","
                            , this.RedFour.ToString("00"), ","
                            , this.RedFive.ToString("00"), ","
                            , this.RedSix.ToString("00"), ":"
                            , this.Blue.ToString("00")
                            );
        }

        public int Sum
        {
            get
            {
                return this.RedOne + this.RedTwo + this.RedThree + this.RedFour + this.RedFive + this.RedSix;
            }
        }

        public int MinSum
        {
            get { return this.minSum; }
        }

        public int MaxSum
        {
            get { return this.maxSum; }
        }

        public bool IsLuckyNumber
        {
            get
            {
                return this.maxSum > this.Sum && this.minSum < this.Sum && this.Sum % 3 != 1;
            }
        }
    }
}